﻿#region Using

using System;
using System.Xml.Serialization;

using Microsoft.Xna.Framework;

#endregion

namespace GameCommon.FontHelper
{
    [Serializable]
    public class FontInfo
    {
        private Rectangle padding;

        private Point spacing;

        [XmlAttribute("bold")]
        public int Bold { get; set; }

        [XmlAttribute("charset")]
        public string CharSet { get; set; }

        [XmlAttribute("face")]
        public string Face { get; set; }

        [XmlAttribute("italic")]
        public int Italic { get; set; }

        [XmlAttribute("outline")]
        public int OutLine { get; set; }

        [XmlAttribute("padding")]
        public string Padding
        {
            get
            {
                return this.padding.X + "," + this.padding.Y + "," + this.padding.Width + "," + this.padding.Height;
            }

            set
            {
                var strings = value.Split(',');
                this.padding = new Rectangle(Convert.ToInt32(strings[0]), Convert.ToInt32(strings[1]), Convert.ToInt32(strings[2]), Convert.ToInt32(strings[3]));
            }
        }

        [XmlAttribute("size")]
        public int Size { get; set; }

        [XmlAttribute("smooth")]
        public int Smooth { get; set; }

        [XmlAttribute("spacing")]
        public string Spacing
        {
            get
            {
                return this.spacing.X + "," + this.spacing.Y;
            }

            set
            {
                var strings = value.Split(',');
                this.spacing = new Point(Convert.ToInt32(strings[0]), Convert.ToInt32(strings[1]));
            }
        }

        [XmlAttribute("stretchH")]
        public int StretchHeight { get; set; }

        [XmlAttribute("aa")]
        public int SuperSampling { get; set; }

        [XmlAttribute("unicode")]
        public int Unicode { get; set; }
    }
}